#include "dialogfilteritem.h"
#include "ui_dialogfilteritem.h"

DialogFilterItem::DialogFilterItem(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogFilterItem)
{
    ui->setupUi(this);
}

DialogFilterItem::~DialogFilterItem()
{
    delete ui;
}

void DialogFilterItem::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void DialogFilterItem::on_buttonBox_accepted()
{
    int i = 0;

    if(this->ui->txtName->text().size() >0)
    {
        filterItemString.push_back( this->ui->txtName->text().toStdString());
    }
    else
    {
        filterItemString.push_back( "noname" );
    }
    if(this->ui->ipOptionThis->isChecked())
    {
        filterItemString.push_back( string("net ") + this->ui->txtIp->text().toStdString() );
    }
    if(this->ui->rbAccept)
        filterItemString.push_back("and");
    else
        filterItemString.push_back("not");
}

void DialogFilterItem::on_buttonBox_rejected()
{
    int i = 0;
}
